#ifndef LOMBINARYOUTSTREAMHH
#define LOMBINARYOUTSTREAMHH
#include "lom-out-stream.hh"
#include "lom-property.hh"

namespace licada { class IBinaryOutStream; }

namespace lom
{
    class ILomOutgoingHandleMap;
    /**
       Conversion of licada and leam types to a binary format.
       Enumerations are 1 byte, most other things are direct little endian
       conversions.  Lengths are stored as 4 byte little endian integers,
       the length is stored before the data.
    */
    class LomBinaryOutStream : public ILomOutStream
    {
	licada::IBinaryOutStream* outStream;
	ILomOutgoingHandleMap* outgoingMap;
	THandleVector tempHandleV;

    public:
	LomBinaryOutStream( licada::IBinaryOutStream* proxy = NULL
			    , ILomOutgoingHandleMap* _outgoingMap = NULL ) 
	    : outStream( proxy )
	      , outgoingMap( _outgoingMap ){}
	virtual ~LomBinaryOutStream(){}
	
	virtual void setup( licada::IBinaryOutStream* proxy
			    , ILomOutgoingHandleMap* _outgoingMap )  { 
	    outStream = proxy;
	    outgoingMap = _outgoingMap;
	}
	
	virtual void operator<<( bool val );
	virtual void operator<<( double val );
	virtual void operator<<( licada::uint8 val );
	virtual void operator<<( licada::uint16 val );
	virtual void operator<<( licada::uint32 val );
	virtual void operator<<( licada::int64 val );
	
	virtual void operator<<( const licada::TDoubleVector& val );
	virtual void operator<<( const licada::TUInt32Vector& val );
	virtual void operator<<( const licada::TInt64Vector& val );
	virtual void operator<<( const licada::TString& val );
	virtual void operator<<( const licada::TStringVector& val );

	
	virtual void operator<<( const licada::TDataVector& val );
	virtual void operator<<( licada::TNameType val);
	virtual void operator<<( EDataType dtype );
	virtual void operator<<( const LomValue* val );
	virtual void operator<<( const TValueVector& val );
	virtual void operator<<( const LomInstance& val );
	virtual void operator<<( const LomClass& val );
	virtual void operator<<( const TPropertyVector& val );
    };
}
#endif
